package test.multiplePatterns;

import dk.au.cs.peterbn.annotations.Member;
import dk.au.cs.peterbn.annotations.Pattern;
import dk.au.cs.peterbn.annotations.Patterns;

/**
 * Created by IntelliJ IDEA.
 * User: peter
 * Date: 8/21/11
 * Time: 2:09 PM
 * To change this template use File | Settings | File Templates.
 */
@Patterns({
    @Pattern(id="test.multiplePatterns.RateStrategy",name = "gof:Strategy",role = "ConcreteStrategy"),
    @Pattern(id="test.multiplePatterns.TimeState",name = "gof:State",role = "Context")
})
public class TimeDependendStrategy implements RateStrategy{

    private State state;

    @Override
    @Member(id="test.multiplePatterns.TimeState", role = "Request")
    public int calculatePrice(int amount) {
        state = new Costly();
        return state.handle();
    }

    @Pattern(id="test.multiplePatterns.TimeState", name = "gof:State", role = "State")
    public interface State{
        @Member(id="test.multiplePatterns.TimeState", role = "Handle")
        public int handle() ;
    }

    @Pattern(id="test.multiplePatterns.TimeState", name = "gof:State", role = "ConcreteState")
    public class Costly implements State{

        @Override
        public int handle() {
            return 0;
        }
    }
}
